package com.ruoyi.web.controller.monitor;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.monitor.domain.BusWaterAutomonitorevaluateDaydata;
import com.ruoyi.monitor.service.IBusWaterAutomonitorevaluateDaydataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 自动站日监测评价Controller
 * 
 * @author maliang
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/monitor/autovaluatedaydata")
public class BusWaterAutomonitorevaluateDaydataController extends BaseController
{
    @Autowired
    private IBusWaterAutomonitorevaluateDaydataService busWaterAutomonitorevaluateDaydataService;

    /**
     * 查询自动站日监测评价列表
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydata:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterAutomonitorevaluateDaydata busWaterAutomonitorevaluateDaydata)
    {
        startPage();
        List<BusWaterAutomonitorevaluateDaydata> list = busWaterAutomonitorevaluateDaydataService.selectBusWaterAutomonitorevaluateDaydataList(busWaterAutomonitorevaluateDaydata);
        return getDataTable(list);
    }

    /**
     * 导出自动站日监测评价列表
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydata:export')")
    @Log(title = "自动站日监测评价", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterAutomonitorevaluateDaydata busWaterAutomonitorevaluateDaydata)
    {
        List<BusWaterAutomonitorevaluateDaydata> list = busWaterAutomonitorevaluateDaydataService.selectBusWaterAutomonitorevaluateDaydataList(busWaterAutomonitorevaluateDaydata);
        ExcelUtil<BusWaterAutomonitorevaluateDaydata> util = new ExcelUtil<BusWaterAutomonitorevaluateDaydata>(BusWaterAutomonitorevaluateDaydata.class);
        util.exportExcel(response, list, "自动站日监测评价数据");
    }

    /**
     * 获取自动站日监测评价详细信息
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydata:query')")
    @GetMapping(value = "/{mn}")
    public AjaxResult getInfo(@PathVariable("mn") String mn)
    {
        return success(busWaterAutomonitorevaluateDaydataService.selectBusWaterAutomonitorevaluateDaydataByMn(mn));
    }

    /**
     * 新增自动站日监测评价
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydata:add')")
    @Log(title = "自动站日监测评价", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusWaterAutomonitorevaluateDaydata busWaterAutomonitorevaluateDaydata)
    {
        return toAjax(busWaterAutomonitorevaluateDaydataService.insertBusWaterAutomonitorevaluateDaydata(busWaterAutomonitorevaluateDaydata));
    }

    /**
     * 修改自动站日监测评价
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydata:edit')")
    @Log(title = "自动站日监测评价", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusWaterAutomonitorevaluateDaydata busWaterAutomonitorevaluateDaydata)
    {
        return toAjax(busWaterAutomonitorevaluateDaydataService.updateBusWaterAutomonitorevaluateDaydata(busWaterAutomonitorevaluateDaydata));
    }

    /**
     * 删除自动站日监测评价
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydata:remove')")
    @Log(title = "自动站日监测评价", businessType = BusinessType.DELETE)
	@DeleteMapping("/{mns}")
    public AjaxResult remove(@PathVariable String[] mns)
    {
        return toAjax(busWaterAutomonitorevaluateDaydataService.deleteBusWaterAutomonitorevaluateDaydataByMns(mns));
    }

    @GetMapping("/qualityLevelStatis")
    public AjaxResult qualityLevelStatis(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterAutomonitorevaluateDaydataService.qualityLevelStatis(id,startTime,endTime));
    }

    /**
     * 水质分布情况
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/statisItemCount")
    public AjaxResult statisItemCount(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterAutomonitorevaluateDaydataService.statisItemCount(id,startTime,endTime));
    }

    /**
     * 水质日历
     * @param id
     * @return
     */
    @GetMapping("/statisCalendar")
    public AjaxResult statisCalendar(String id,String year){
        return AjaxResult.success(busWaterAutomonitorevaluateDaydataService.statisCalendar(id,year));
    }

    @GetMapping("/trendStatis")
    public AjaxResult trendStatis(String id,String startTime,String endTime,String items){
        return AjaxResult.success(busWaterAutomonitorevaluateDaydataService.trendStatis(id,startTime,endTime,items));
    }

    /**
     * 水质级别趋势
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/trendQuality")
    public AjaxResult trendQuality(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterAutomonitorevaluateDaydataService.trendQuality(id,startTime,endTime));
    }
}
